import axios from '../plugin/axios/axios'

//获取资讯列表
export const informationList = (present,length) => {
  return axios({
      url: `/api/v1/news?page_no=${present}&per_page=${length}`,
      method: 'GET',
  },true)
}
//获取审核中的列表
export const informationunderreview = (present,length) => {
    return axios({
        url: `/api/v1/news?status=processing&page_no=${present}&per_page=${length}`,
        method: 'GET',
},true)
}
//添加资讯
export const informationadd = (data) => {
    return axios({
        url: `/api/v1/news`,
        method: 'POST',
        data
    },true)
}
// 编辑资讯
export const informationcompile = (id) => {
    return axios({
        url: `/api/v1/news/${id}`,
        method: 'GET',
    },true)
}
// 资讯修改
export const informationmodification = (data,id) => {
    return axios({
        url: `/api/v1/news/${id}`,
        method: 'PUT',
        data
    },true)
}
//资讯删除
export const informationdelete = (id) => {
    return axios({
        url: `/api/v1/news/${id}`,
        method: 'DELETE',
    },true)
}
//资讯下架
export const informationsoldout = (id,status) => {
    return axios({
        url: `/api/v1/news/${id}/${status}`,
        method: 'PUT',
    },true)
}
export default {
    informationList,
    informationadd,
    informationcompile,
    informationmodification,
    informationdelete,
    informationsoldout,
    informationunderreview
}